SandBlock = class(Block)

function SandBlock:init(id,tex,destoryTime)
    Block.init(self,id,tex,destoryTime)
end

function SandBlock:neighborChanged(x,y,z,face,block)
    world:markBlockNeedTick(x,y,z)
end

function SandBlock:blockBeSet(x,y,z)
    self:tryToFall(x,y,z)
end

function SandBlock:tryToFall(x,y,z)
    local block = world:getBlock(x,y - 1,z)
    if block == Block.air.id then
        world:setBlock(x,y,z,Block.air.id)
        world.entityList:add(FallingBlock(self,x,y,z))
    end
end

function SandBlock:tick(x,y,z,isMarkedTick)
    if isMarkedTick then
        self:tryToFall(x,y,z)
    end
end
